package cn.wolfcode.mq.linstener;

import cn.wolfcode.domain.OrderInfo;
import cn.wolfcode.mapper.OrderInfoMapper;
import cn.wolfcode.mq.MQConstant;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: 普发忠
 * @Date: 2021/11/11/14:17
 */
@Component
@RocketMQMessageListener(
        topic = MQConstant.PAY_ZFB_REFUND,
        consumerGroup = "pay_zfb_refund-consumer"
)
public class PaysRefundListener implements RocketMQListener<String> {
    @Autowired
    private OrderInfoMapper orderInfoMapper;
    
    @Override
    public void onMessage(String order) {
        orderInfoMapper.changeRefundStatus(order, OrderInfo.STATUS_REFUND);
    }
}
